//
//  FuntionListViewController.m
//  PersonalTool
//
//  Created by Samuel on 2/9/15.
//  Copyright (c) 2015 Samuel. All rights reserved.
//

#import "FuntionListViewController.h"
#import "FuntionCells.h"
#import "GifFuntionViewController.h"
#import "MainViewSleton.h"
#import "FreeColorController.h"
@interface FuntionListViewController ()

@end

@implementation FuntionListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"FuntionCells" owner:self options:nil];
    UIView *tmpCustomView = [nib objectAtIndex:0];
    return tmpCustomView.frame.size.height;
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    NSString *CellIdentifier = [NSString stringWithFormat:@"FuntionList%li",(long)indexPath.row];
    UINib *nib = [UINib nibWithNibName:@"FuntionCells" bundle:nil];
    [tableView registerNib:nib forCellReuseIdentifier:CellIdentifier];
    
    FuntionCells *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[FuntionCells alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        
        
        
    }
    switch (indexPath.row) {
        case 0:
            cell.funtionTitle.text = @"Gif 微信分享功能";
            break;
        case 1:
            cell.funtionTitle.text = @"自定义主题颜色";
            break;
        case 2:
            cell.funtionTitle.text = @"暂无";
            break;
        case 3:
            cell.funtionTitle.text = @"暂无";
            break;
        case 4:
            cell.funtionTitle.text = @"暂无";
            break;
        default:
            break;
    }
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [[MainViewSleton sharedInstance].LSVC hideSideViewController:YES];
    if (indexPath.row == 0) {
        UIStoryboard *GifFuntionStroyBoard=[UIStoryboard storyboardWithName:@"GifFuntion" bundle:nil];
        UIViewController *GMVC = [GifFuntionStroyBoard instantiateInitialViewController];
        [self presentViewController:GMVC animated:YES completion:^{
            ;
        }];
    }
    if (indexPath.row == 1) {
        FreeColorController *FCC = [[FreeColorController alloc]init];
        UINavigationController *FCCNAV = [[UINavigationController alloc]initWithRootViewController:FCC];
        [self presentViewController:FCCNAV animated:YES completion:^{
            ;
        }];
    }
}


@end
